package com.junit;

import com.alibaba.fastjson.JSON;
import com.bjsxt.dao.UserMapper;
import com.bjsxt.entity.User;
import org.apache.log4j.Logger;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * Created by 苏犇 on 2018/12/22. <br>
 */
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(value = {"classpath:applicationContext.xml"})
public class RunMain {

    private static Logger logger = Logger.getLogger(RunMain.class);

    @Autowired
    private UserMapper userMapper;

    @Test
    public void getAdminByPrimarykeyTest(){
       User user = userMapper.selectByUsernamePassword("suben","password");
       logger.info(JSON.toJSONString(user));
    }
}
